package com.album.activity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
 *  状态机
 *  作者：Rome
 */

import android.graphics.Bitmap;

import com.album.activity.page.PageManager;
import com.album.activity.pageView.UserLoginView;
import com.album.activity.pageView.MyFriendsView;
import com.album.activity.pageView.MyPhotoView;
import com.album.activity.pageView.PicinfoView;
import com.album.activity.pageView.CasualLookView;
public class SetstateManager {
	public static HashMap<Class,PageManager> classStateMap = new HashMap<Class,PageManager>();
	public static HashMap<Class,PageManager> refreshMap = new HashMap<Class,PageManager>();
	public static HashMap<String,List<Bitmap>> picMap = new HashMap<String,List<Bitmap>>();
	public static List<Bitmap> piclist = new ArrayList<Bitmap>();
	public static final Class UserLoginView= UserLoginView.class;
	public static final Class MainActivity= MainActivity.class;
	public static final Class MyFriendsView = MyFriendsView.class;
	public static final Class MyPhotoView = MyPhotoView.class;
	public static final Class PicinfoView = PicinfoView.class;
	public static final Class CasualLookView = CasualLookView.class;
	
	public static void setClassStates(Class c ,PageManager m){
		try {
			if(classStateMap != null && !classStateMap.isEmpty())
			     classStateMap.clear();
			if(classStateMap != null)
			     classStateMap.put( c, m);
		} catch (Exception e) {
			e.printStackTrace();
		}
	
	}
	public static void setRefresClass(Class c,PageManager m){
		try {
			if(classStateMap != null && !classStateMap.isEmpty())
			     classStateMap.clear();
			if(classStateMap != null)
			     classStateMap.put( c, m);
		} catch (Exception e) {
			e.printStackTrace();
		}
	
	}
	public static void setPicMapState(String username,List<Bitmap> piclist){
		try {
//			if(picList != null && !picList.isEmpty())
//				picList.clear();
			if(picMap != null && piclist != null)
			picMap.put(username, piclist);
		} catch (Exception e) {
			e.printStackTrace();
		}
	
	}
}
